package com.yaokai.springsecuritydemo01.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.formLogin()//采用表单登录方式鉴权
                .and().authorizeRequests()// 关于认证的配置
                .anyRequest()// 任何请求
                .authenticated();// 都需要身份验证
    }
}
